import React, { Component } from 'react';
import Iteam from '../Iteam';
import PropTypes from 'prop-types';
import './index.css'

class List extends Component {
    static propTypes={
        todos:PropTypes.array.isRequired,
        updateTodo:PropTypes.func.isRequired
    }
    render() {
        const {todos,updateTodo,deleteTodo}=this.props; 
        return (
            <ul className="todo-main">
                {
                    todos.map((iteam,index)=>{
                        return <Iteam  key={iteam.id} {...iteam}  updateTodo={updateTodo} deleteTodo={deleteTodo}/>
                    })
                }
            </ul>
        );
    }
}

export default List;